import axios from './axios';
import { LoginProps, RegisterProps } from './types';

/**
 * 获取验证码
 */
export const getValidateCode = function () {
    return axios.get('getValidateCode')
}


/**
 * 注册
 * @param data 
 */
export const register = function (data: RegisterProps) {
    return axios.post('/register', { data })
}

/**
 * 登录
 * @param data 
 */
export const login = function (data: LoginProps) {
    return axios.post('/login', { data })
}

/**
 *校验登录信息
 */
export const validate = function () {
    return axios.get('/validate')
}

/**
 * 退出登录
 */
export const logout = function () {
    return axios.get('/logout');
}